package com.myh.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.myh.common.valid.AddGroup;
import com.myh.common.valid.ListValue;
import com.myh.common.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author myh
 * @email 2722407149@qq.com
 * @date 2024-01-01 11:42:39
 */
@Data
@TableName("pms_brand")
@ApiModel("品牌实体类")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@ApiModelProperty("品牌ID")
	@Null(message = "新增不能指定ID", groups = AddGroup.class)
	@NotNull(message = "修改必须指定品牌ID", groups = UpdateGroup.class)
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@ApiModelProperty("品牌名字")
	@NotBlank(message = "品牌名字段不能为空", groups = AddGroup.class)
	private String name;
	/**
	 * 品牌logo地址
	 */
	@ApiModelProperty("品牌地址")
	@NotBlank(message = "品牌logo地址不能为空", groups = AddGroup.class)
	@URL(message = "logo必须是一个合法的URL地址", groups = {AddGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@ApiModelProperty("品牌描述")
	@NotBlank(message = "介绍字段不能为空", groups = AddGroup.class)
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ApiModelProperty("显示状态")
	@NotNull(message = "显示状态不能为空", groups = AddGroup.class)
	@ListValue(values = {0, 1}, message = "显示状态只能为0或1", groups = {AddGroup.class, UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@ApiModelProperty("检索首字母")
	@NotBlank(message = "检索首字母字段不能为空", groups = AddGroup.class)
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母", groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@ApiModelProperty("排序字段")
	@NotNull(message = "排序字段不能为空", groups = AddGroup.class)
	@Min(value = 0, message = "排序字段为一个非负整数", groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
